﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CourseInfo.aspx.cs" Inherits="CourseManager.View.Contents.Teacher.CourseInfo" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>课程管理</title>
	<script type="text/javascript">


		var startEditing = function (e) {
			if (e.getKey() === e.ENTER) {
				var grid = GridPanel1,
                    record = grid.getSelectionModel().getSelected(),
                    index = grid.store.indexOf(record);

				grid.startEditing(index, 1);
			}
		};

		var afterEdit = function (e) {
			/*
			Properties of 'e' include:
			e.grid - This grid
			e.record - The record being edited
			e.field - The field name being edited
			e.value - The value being set
			e.originalValue - The original value for the field, before the edit.
			e.row - The grid row index
			e.column - The grid column index
			*/

			// Call DirectMethod
			CompanyX.AfterEdit(e.record.data.ID, e.field, e.originalValue, e.value, e.record.data);
		};
	</script>
</head>
<body>
	<form id="form1" runat="server">
	<ext:ResourceManager runat="server" />
	<ext:Store runat="server" ID="StudentStore">
		<Reader>
			<ext:JsonReader IDProperty="studentId">
				<Fields>
					<ext:RecordField Name="studentId" />
					<ext:RecordField Name="studentName" />
<%--					<ext:RecordField Name="absent1" />--%>
<%--					<ext:RecordField Name="absent2" />--%>
<%--					<ext:RecordField Name="absent3" />--%>
<%--					<ext:RecordField Name="absent4" />--%>
<%--					<ext:RecordField Name="absent5" />--%>
<%--					<ext:RecordField Name="absent6" />--%>
<%--					<ext:RecordField Name="absent7" />--%>
<%--					<ext:RecordField Name="absent8" />--%>
<%--					<ext:RecordField Name="absent9" />--%>
<%--					<ext:RecordField Name="absent10" />--%>
					<ext:RecordField Name="dayGrade" />
					<ext:RecordField Name="examGrade" />
					<ext:RecordField Name="grade" />
				</Fields>
			</ext:JsonReader>
		</Reader>
	</ext:Store>
	<ext:CompositeField ID="CompositeField1" runat="server" Width="400">
		<Items>
			<ext:Label ID="Label1" Text="选择课程: " Margins="14 10 10 10" runat="server" />
			<ext:ComboBox runat="server" ID="cbCourse" Width="180" SelectOnFocus="true" ClearButton="true"
				BlankText="请选择课程" SelectedIndex="0" Editable="false" Margins="10 10 10 0">
			</ext:ComboBox>
			<ext:Button runat="server" Text="刷新" ID="btnRefresh" Icon="accept" Margins="10 0 10 10">
				<DirectEvents>
					<%--			<Click OnEvent="BtnRefreshClick">--%>
					<%--				<EventMask ShowMask="true" Msg="正在添加,请稍后..." />--%>
					<%--			</Click>--%>
				</DirectEvents>
			</ext:Button>
		</Items>
	</ext:CompositeField>
	<ext:GridPanel ID="GridPanel1" runat="server" StripeRows="true"
		TrackMouseOver="true" Width="500" Height="600" X="20" Y="20" StoreID="studentStore">
		<Listeners>
			<KeyDown Fn="startEditing" />
			<AfterEdit Fn="afterEdit" />
		</Listeners>
		<ColumnModel runat="server">
			<Columns>
				<ext:Column Header="学号" Align="Center" DataIndex="studentId" Width="100" />
				<ext:Column Header="姓名" Align="Center" DataIndex="studentName" Width="100" />
				<ext:Column Header="平时成绩" Align="Center" DataIndex="dayGrade" Width="100">
					<Editor>
						<ext:TextField ID="txtAbsent1" runat="server"/>
					</Editor>
				</ext:Column>
				<ext:Column Header="考试成绩" Align="Center" DataIndex="examGrade" Width="100">
					<Editor>
						<ext:TextField ID="txtAbsent2" runat="server" />
					</Editor>
				</ext:Column>
				<ext:Column Header="总评成绩" Align="Center" DataIndex="grade" Width="100">
					<Editor>
						<ext:TextField ID="TextField1" runat="server" />
					</Editor>
				</ext:Column>

			</Columns>
		</ColumnModel>
		<SelectionModel>
			<ext:RowSelectionModel runat="server" SingleSelect="true" />
		</SelectionModel>
	</ext:GridPanel>
	</form>
</body>
</html>
